/* 重置和基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: transform 0.3s ease;
    z-index: 1000;
    transform: translateX(0); /* 确保桌面端始终可见 */
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 1.2em;
    font-weight: 600;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    display: none;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 5px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav li.active a {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #4facfe;
}

.sidebar-nav a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 主内容区域 */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* 顶部导航栏 */
.topbar {
    background: white;
    padding: 15px 30px;
    border-bottom: 1px solid #e5e9f2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.topbar-left {
    display: flex;
    align-items: center;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.2em;
    color: #666;
    cursor: pointer;
    margin-right: 15px;
    display: none;
}

.topbar h1 {
    font-size: 1.5em;
    font-weight: 600;
    color: #2d3748;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.user-info i {
    font-size: 1.5em;
}

/* 内容区域 */
.content {
    padding: 30px;
}

/* 页面切换 */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    font-size: 1.8em;
    color: #2d3748;
    font-weight: 600;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.5em;
}

.stat-card:nth-child(1) .stat-icon {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    color: white;
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    color: white;
}

.stat-card:nth-child(4) .stat-icon {
    background: linear-gradient(45deg, #43e97b, #38f9d7);
    color: white;
}

.stat-info h3 {
    font-size: 2em;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-info p {
    color: #718096;
    font-weight: 500;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.btn i {
    font-size: 0.9em;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.btn-danger {
    background: linear-gradient(45deg, #fe6b8b, #ff8e53);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(254, 107, 139, 0.4);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.data-table .loading {
    text-align: center;
    color: #718096;
    font-style: italic;
}

.data-table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-active, .status-published {
    background: #c6f6d5;
    color: #22543d;
}

.status-inactive, .status-draft {
    background: #fed7d7;
    color: #742a2a;
}

.status-completed {
    background: #bee3f8;
    color: #2a4365;
}

.status-cancelled, .status-archived {
    background: #e2e8f0;
    color: #4a5568;
}

/* 难度标签 */
.difficulty-beginner {
    background: #c6f6d5;
    color: #22543d;
}

.difficulty-intermediate {
    background: #faf089;
    color: #744210;
}

.difficulty-advanced {
    background: #fed7d7;
    color: #742a2a;
}

/* 评分显示 */
.rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stars {
    color: #f6ad55;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    min-width: 150px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    animation: slideIn 0.3s ease;
}

.modal-content.large {
    max-width: 700px;
}

.modal-content.small {
    max-width: 400px;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.3em;
    font-weight: 600;
    color: #2d3748;
}

.close {
    font-size: 1.5em;
    color: #718096;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: #e53e3e;
}

.modal-body {
    padding: 20px 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* 图表容器 */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.chart-container h4 {
    font-size: 1.2em;
    color: #2d3748;
    margin-bottom: 20px;
    font-weight: 600;
}

/* 提示框 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 3000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: linear-gradient(45deg, #48bb78, #38a169);
}

.toast.error {
    background: linear-gradient(45deg, #f56565, #e53e3e);
}

.toast.info {
    background: linear-gradient(45deg, #4299e1, #3182ce);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%); /* 移动端默认隐藏 */
    }
    
    .sidebar.open {
        transform: translateX(0); /* 移动端打开时显示 */
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle,
    .menu-toggle {
        display: block;
    }
}

/* 桌面端样式 */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important; /* 桌面端始终可见 */
    }
    
    .sidebar-toggle,
    .menu-toggle {
        display: none; /* 桌面端隐藏切换按钮 */
    }
}

@media (max-width: 768px) {
    .content {
        padding: 20px 15px;
    }
    
    .topbar {
        padding: 15px 20px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px 0;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 15px 10px;
    }
    
    .topbar {
        padding: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-info h3 {
        font-size: 1.5em;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px 20px;
    }
}

/* 加载状态 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.empty-state i {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #4a5568;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 4px 8px;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    margin: 2px;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 搜索框 */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9em;
}

.search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #4a5568;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
} 